<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- enumerator.qdoc -->
  <title>qesp : enumerator Demo</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
</head>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="postheader" valign="center"><a href="index.html">Home</a> &middot; <a href="classes.html">All Classes</a> &middot;</td></tr></table><li><a href="http://qt-project.org/doc/qt-4.8/all-examples.html">Examples</a></li>
<li>enumerator Demo</li>
<h1 class="title">enumerator Demo</h1>
<span class="subtitle"></span>
<!-- $$$examples/enumerator-description -->
<div class="descr"> <a name="details"></a>
<p>Files:</p>
<ul>
<li><a href="examples-enumerator-main-cpp.html">examples/enumerator/main.cpp</a></li>
<li><a href="examples-enumerator-enumerator-pro.html">examples/enumerator/enumerator.pro</a></li>
</ul>
<p>The example demonstrates how to use <a href="qextserialenumerator.html">QextSerialEnumerator</a>.</p>
<p>Include the proper header file</p>
<pre class="cpp">    <span class="preprocessor">#include &quot;qextserialenumerator.h&quot;</span></pre>
<p>Get available ports in the system.</p>
<pre class="cpp">    <span class="type"><a href="http://qt-project.org/doc/qt-4.8/qlist.html">QList</a></span><span class="operator">&lt;</span>QextPortInfo<span class="operator">&gt;</span> ports <span class="operator">=</span> QextSerialEnumerator<span class="operator">::</span>getPorts();</pre>
<p>Output</p>
<pre class="cpp">    foreach (QextPortInfo info<span class="operator">,</span> ports) {
        <a href="http://qt-project.org/doc/qt-4.8/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;port name:&quot;</span>       <span class="operator">&lt;</span><span class="operator">&lt;</span> info<span class="operator">.</span>portName;
        <a href="http://qt-project.org/doc/qt-4.8/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;friendly name:&quot;</span>   <span class="operator">&lt;</span><span class="operator">&lt;</span> info<span class="operator">.</span>friendName;
        <a href="http://qt-project.org/doc/qt-4.8/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;physical name:&quot;</span>   <span class="operator">&lt;</span><span class="operator">&lt;</span> info<span class="operator">.</span>physName;
        <a href="http://qt-project.org/doc/qt-4.8/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;enumerator name:&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> info<span class="operator">.</span>enumName;
        <a href="http://qt-project.org/doc/qt-4.8/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;vendor ID:&quot;</span>       <span class="operator">&lt;</span><span class="operator">&lt;</span> info<span class="operator">.</span>vendorID;
        <a href="http://qt-project.org/doc/qt-4.8/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;product ID:&quot;</span>      <span class="operator">&lt;</span><span class="operator">&lt;</span> info<span class="operator">.</span>productID;

        <a href="http://qt-project.org/doc/qt-4.8/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;===================================&quot;</span>;
    }</pre>
</div>
<!-- @@@examples/enumerator -->
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2000-2012</td>
<td width="20%" align="center"><a href="http://code.google.com/p/qextserialport">QextSerialPort Project</a></td>
<td width="40%" align="right"><div align="right">QextSerialPort Manual</div></td>
</tr></table></div></address></body>
</html>
